import request from '@/utils/request'

//  分页查询流程定义信息
export function handleGetPageList(query) {
  return request({
    url: '/api/flow/definition/page',
    method: 'post',
    data: query
  })
}

//  保存流程定义信息
export function handleSave(data) {
  return request({
    url: '/api/flow/definition/save',
    method: 'post',
    data: data
  })
}

//  删除流程定义信息
export function handleDelete(data) {
  return request({
    url: '/api/flow/definition/delete',
    method: 'post',
    params: data
  })
}

//  挂起流程定义信息
export function handleSuspend(data) {
  return request({
    url: '/api/flow/definition/suspend',
    method: 'post',
    params: data
  })
}

//  激活流程定义信息
export function handleActive(data) {
  return request({
    url: '/api/flow/definition/active',
    method: 'post',
    params: data
  })
}

//  查看流程定义图
export function handleDiagram(data) {
  return request({
    url: '/api/flow/definition/process/diagram?processDefId=' + data,
    method: 'get',
    // 重要
    responseType: 'blob'
  })
}

//  下载流程定义xml文件
export function handleXml(data) {
  return request({
    url: '/api/flow/definition/process/xml?processDefId=' + data,
    method: 'get',
    // 重要
    responseType: 'blob'
  })
}

// 查询获取所有的流程配置
export function handleGetAttrPageList(query) {
  return request({
    url: '/api/flow/proc/attribute/page',
    method: 'post',
    data: query
  })
}

// 保存流程配置
export function handleSaveAttr(data) {
  return request({
    url: '/api/flow/proc/attribute/save',
    method: 'post',
    data: data
  })
}

// 删除流程配置
export function handleDeleteAttr(data) {
  return request({
    url: '/api/flow/proc/attribute/delete',
    method: 'post',
    params: data
  })
}

// 查询获取所有的人工节点
export function handleGetAllUserTask(data) {
  return request({
    url: '/api/flow/definition/getAllUserTask',
    method: 'post',
    params: data
  })
}

// 查询获取所有的流程候选权限
export function handleGetCandidatePageList(query) {
  return request({
    url: '/api/flow/task/candidate/page',
    method: 'post',
    data: query
  })
}

// 保存流程候选权限
export function handleSaveCandidate(data) {
  return request({
    url: '/api/flow/task/candidate/save',
    method: 'post',
    data: data
  })
}

// 删除流程候选权限
export function handleDeleteCandidate(data) {
  return request({
    url: '/api/flow/task/candidate/delete',
    method: 'post',
    params: data
  })
}

//  分页查询流程表单信息表信息
export function handleGetFormPageList(query) {
  return request({
    url: '/api/flow/proc/form/page',
    method: 'post',
    data: query
  })
}

//  保存流程表单信息表信息
export function handleSaveForm(data) {
  return request({
    url: '/api/flow/proc/form/save',
    method: 'post',
    data: data
  })
}

//  删除流程表单信息表信息
export function handleDeleteForm(data) {
  return request({
    url: '/api/flow/proc/form/deleteById/' + data,
    method: 'get'
  })
}

//  拷贝流程定义相关配置从上一个版本获取
export function handleCopy(data) {
  return request({
    url: '/api/flow/proc/info/copy',
    method: 'post',
    params: data
  })
}
